package mtype

type ServerConfig struct {
	Port int    `yaml:"port"`
	Host string `yaml:"host"`
}

type DatabaseConfig struct {
	Type       string `yaml:"type"`
	Connection struct {
		Host     string `yaml:"host"`
		Port     int    `yaml:"port"`
		Database string `yaml:"database"`
		Username string `yaml:"username"`
		Password string `yaml:"password"`
	} `yaml:"connection"`
}

type LoggingConfig struct {
	Level  string `yaml:"level"`
	Path   string `yaml:"path"`
	Format string `yaml:"format"`
}

type CacheConfig struct {
	Type          string `yaml:"type"`
	Host          string `yaml:"host"`
	Port          int    `yaml:"port"`
	Password      string `yaml:"password"`
	Db            int    `yaml:"db"`
	Expiration    int    `yaml:"expiration"`
	CodeExpiresIn int    `yaml:"codeExpiresIn"` // 验证码过期时间
}

type SecurityConfig struct {
	APIKey          string `yaml:"apiKey"`
	JwtSecret       string `yaml:"jwtSecret"`
	TokenExpiration int    `yaml:"tokenExpiration"`
	RateLimit       int    `yaml:"rateLimit"`
	BanTime         int    `yaml:"banTime"`
}

type PerformanceConfig struct {
	ThreadCount        int `yaml:"threadCount"`
	ConnectionPoolSize int `yaml:"connectionPoolSize"`
}

type ThirdPartyConfig struct {
	int
	SMSGateway struct {
		APIKey   string `yaml:"apiKey"`
		Endpoint string `yaml:"endpoint"`
	} `yaml:"smsGateway"`
}

type EnvironmentConfig struct {
	Dev  map[string]string `yaml:"dev"`
	Test map[string]string `yaml:"test"`
	Prod map[string]string `yaml:"prod"`
}

type ResourceLimitsConfig struct {
	MemoryLimit     string `yaml:"memoryLimit"`
	UploadSizeLimit string `yaml:"uploadSizeLimit"`
}

type TimeoutsConfig struct {
	RequestTimeout  string `yaml:"requestTimeout"`
	DatabaseTimeout string `yaml:"databaseTimeout"`
}
type FrontConfig struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

type Config struct {
	Server         ServerConfig         `yaml:"server"`
	Database       DatabaseConfig       `yaml:"database"`
	Logging        LoggingConfig        `yaml:"logging"`
	Cache          CacheConfig          `yaml:"cache"`
	Email          EmailConfig          `yaml:"email"`
	Security       SecurityConfig       `yaml:"security"`
	Front          FrontConfig          `yaml:"front"`
	Performance    PerformanceConfig    `yaml:"performance"`
	ThirdParty     ThirdPartyConfig     `yaml:"thirdParty"`
	Environment    EnvironmentConfig    `yaml:"environment"`
	ResourceLimits ResourceLimitsConfig `yaml:"resourceLimits"`
	Timeouts       TimeoutsConfig       `yaml:"timeouts"`
}

// token 配置
type TokenConfig struct {
	UserID int64  `json:"user_id"`
	Email  string `json:"email"`
	Exp    int    `json:"exp"`
}

// 邮箱配置
type EmailConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	From     string `yaml:"from"`
	To       string `yaml:"to"`
}

// EmailInfo 存储邮件相关信息
type EmailSendContent struct {
	From         string      // 发件人
	To           []string    // 收件人
	CC           []string    // 抄送
	Subject      string      // 邮件主题
	Template     string      // 模板文件路径
	TemplateData interface{} // 模板渲染所需的数据
}
